package com.fosu.vo;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;
import java.util.Set;

/**
 * @author zqa
 * @version 1.0
 * @date 2020/10/30 15:35
 */

public class UserDetail implements UserDetails , Serializable {

    private String openId;

    private String username;

    private String password;

    private Set<? extends GrantedAuthority> authorities;//权限列表

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public UserDetail setUsername(String username) {
        this.username = username;
        return this;
    }

    public UserDetail  setPassword(String password) {
        this.password = password;
        return this;
    }

    public UserDetail  setAuthorities(Set<? extends GrantedAuthority> authorities) {
        this.authorities = authorities;
        return this;
    }

    public String getOpenId() {
        return openId;
    }


    public UserDetail setOpenId(String openId) {
        this.openId = openId;
        return this;
    }


}
